Quantity, up to Type a quantity quantity must be a whole number between 1 and 999 inclusive Password password tooltip enter password password must be at least 3 characters in length Shipping rate Type a rate shipping rate must be a decimal number between 1 and 999 inclusive 2 red 11 3333 2 department 2 53 red 44 33 2 department 2 55 red 1.2 5 department 5 111 red 11 1111 1 department 1 <U>t</U>emplate t
Last updated on 5/15/01

DynamicTable Widget

/widgets/EditHTC/dynamictable.htc

Cousin of the ListEditor widget. Both return their result as an XML list document. The DynamicTable allows editing of lists where only columns displayed in the list are editable fields. Columns are displayed in the order that they are specified in the meta-data.

Loading Property Group...

OnChange returns:


events

onError
fires on error (when m_bDebug = true in HTC, shows alert as well)

event object properties

window.event.error String. Returns error detail.

onChange
fires after user clicks 'Done' or 'Remove' buttons.

event object properties

window.event.XMLlist XMLNode. XML document node containing the list. Each row is in a child <record> node containing a sub-node for each field/column. Each <record> node is marked by a state attribute with one of four values: "" = unchanged, "new", "changed", or "deleted". Select columns return as two sub-nodes; one with the name of the column that contains the underlying value, and one named columnId_displayvalue containing the display name for that value. (this test page simply displays the event.XMLlist.xml in the text area above) NOTE: if @overx meta-xml attribute is used the "Over X" record key will have the value "-1".

onRequire
fires when required status changes on the list

event object properties

window.event.required Boolean. Returns true if the control is marked as required and the table is currently empty, false otherwise

onValid
fires when a user starts to edit a row and when they complete editing a row

event object properties

window.event.valid Boolean. Returns false if fired because user started to edit a row, false when Cancel or Accept is clicked

methods

set elEditField = elDynamicTable.field(sFieldId)
Gets the sub-control field element (HTML element with HTC attached)

parameters

sFieldId Required. ID of field (column/field name in recordset).

return value

HTMLElement. Returns the sub-control element for the field if sFieldId is a valid field in the elDynamicTable, null otherwise

remarks

Once you have used this method to get a field control element you can use any of the methods and properties available to an EditField control. Please see the EditField reference for details.

elDynamicTable.cleanup()
Removes all records marked with state='deleted' and clears the state attribute for all remaining records

parameters

none

return value

none

container attributes (set on element using DynamicTable behavior)

DataXML xml data (from a recordset) data-island id. Usually in the format:
	<document>
		<record>
			<fieldId1>fieldValue1</fieldId1>
			<fieldId2>fieldValue2</fieldId2>
			...
		</record>
		...
	</document>
MetaXML xml meta-data data-island id

scriptable properties

bValue = elDynamicTable.dirty
Read-only. Returns true if a row has been added, removed or edited, false otherwise.
bValue = elDynamicTable.required
Read-only. Returns true if the field is required and currently has no value, false otherwise. OnRequire event fires when this value changes. NOTE: if @overx meta-xml attribute is used required will always be false (since the "Over X" row is added).
set xmlList = elDynamicTable.XMLlist
Read-only. XML document node containing the list. Each row is in a child <record> node containing a sub-node for each field/column. Each record is marked by a state attribute with one of four values: "" = unchanged, "new", "changed", or "deleted". Select columns return two sub-nodes; one with the name of the column containing the underlying value and one named columnId_displayvalue containing the display name for that value. NOTE: if @overx meta-xml attribute is used the "Over X" record key will have the value "-1".

meta-xml

KEY:     <NodeTag>     <RepeatingNodeTag*>     @attribute

sample

<xml id='dtMeta'>
  <dynamictable>
	<global keycol='quantity' required='yes' uniquekey='yes' sortbykey='yes'/>
	<fields>
	  <numeric id='quantity' width='180' required='yes'
		  min='1' max='999' subtype='integer'>
		<name>Quantity, up to:</name>
		<prompt>&lt;Type a quantity&gt;</prompt>
		<error></error>
	  </numeric>
	  <numeric id='rate' width='125' required='yes' min='1' max='999' subtype='float'>
		<name>Shipping rate:</name>
		<prompt>&lt;Type a rate&gt;</prompt>
		<error></error>
	  </numeric>
	  <text id='foo' hide='yes' subtype='short'>
		<name>hidden column</name>
		<prompt></prompt>
		<error>hidden column error</error>
	  </text>
	  <text id='text' width='145' required='yes' maxlen='30' subtype='short'>
		<name>Shipping text:</name>
		<prompt>&lt;Type shipping text&gt;</prompt>
		<error></error>
	  </text>
	</fields>
  </dynamictable>
</xml>